$(document).ready(function(){
    $.ajax({
        url:"fpyj.json",
        type:"GET",
        dataType:"json",
        success:function(data){
            var typeArr=new Array();
            var numArr=new Array();
            $.each(data,function(i,n){
                typeArr[i]=n["Name"];
                numArr[i]=n["Num"];
            })
            alert(typeArr);
            alert(numArr);
            //var arr=["诈骗电话","骚扰电话","对我进行人身攻击","推销假货","诈骗短信","传销","中介"]
            var myChart1 = echarts.init(document.getElementById('jbtype1'));
            var option={
                tooltip:{//提示框
                    show:true
                },
                legend:{//图例
                    data:['举报类型人数']
                },
                xAxis:[
                    {
                        type:'value'
                    }
                ],
                yAxis:[{
                    type:'category',
                    data:typeArr
                }],
                series:[//设置数据
                    {
                        itemStyle:{
                            normal:{
                                color:function(params){
                                    var colorList=['#ff7241','#ffd011','#71cffe','#40d041','#aa7941',
                                        '#7170ff','#d0a0ff'];
                                    return colorList[params.dataIndex]
                                }
                            }
                        },
                        "name":"举报类型人数",
                        "type":"bar",
                        "data":numArr
                    }
                ]
            };
            //为myCharts对象加载数据
            myChart1.setOption(option);
        }
    });
});
